#ifndef BOARD_H
#define BOARD_H

#include <QWidget>
#include <QHBoxLayout>
#include <cell.h>
#include <selection.h>
#include <moveimpl.h>

class Board : public QWidget
{
    Q_OBJECT
public:
    explicit Board(QWidget *parent = nullptr);
    Cell* getCell(int x, int y);
    QHBoxLayout *getLayout() const;

protected:
    virtual void mousePressEvent(QMouseEvent *e);
    virtual void paintEvent(QPaintEvent *event);
private:
    Cell *m_cells[64];
    Selection *m_selection;
    QHBoxLayout *m_layout;
    bool m_editing{false};
    bool m_white_move{true};

    void previousMove();
    void loadBoardImage();
    void draw_selection(Cell *point);
    void clear();
public slots:
    void move(Cell *start, Cell *end);
    void clearBoard();
    void setEditing(bool state);

signals:

};

#endif // BOARD_H
